package cn.skyquant.quant4j.service.boot.model.order;

import cn.skyquant.quant4j.service.boot.model.account.Account;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.util.Date;
import java.util.Objects;

@Entity
public class AccountOrderHis {
    @Id
    public String id;
    @ManyToOne
    public Account account;
    public String symbol;
    public String label;
    public double amount;
    public String comment;
    public String command;
    public double openPrice;
    public double closePrice;
    public double sl;
    public double tp;
    public Date creationTime;
    public Date fillTime;
    public Date closeTime;
    public double commission;
    public double profit;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AccountOrderHis that = (AccountOrderHis) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
